﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Security;

namespace HomeDump.Server.Components.MusicSearch
{
	/// <summary>
	/// Interface wrapping the <see cref="Directory"/> class.
	/// </summary>
	public interface IDirectoryWrapper
	{
		/// <summary>
		/// Returns an enumerable collection of file names that match a search pattern in a specified
		/// path, and optionally searches subdirectories.
		/// </summary>
		/// <param name="path">The directory to search. </param>
		/// <param name="searchPattern">The search string to match against the names of directories in path. </param>
		/// <param name="searchOption">
		/// One of the values of the <see cref="SearchOption"/> enumeration that specifies whether the
		/// search operation should include only the current directory or should include all
		///  subdirectories.
		/// <para/>
		/// The default value is TopDirectoryOnly.
		/// </param>
		/// <returns>
		/// An enumerable collection of file names in the directory specified by path and that match
		/// searchPattern and searchOption.
		/// </returns>
		/// <exception cref="ArgumentException">
		/// path is a zero-length string, contains only white space, or contains invalid characters as
		/// defined by GetInvalidPathChars.
		/// <para/>
		/// - or -
		/// <para/>
		/// searchPattern does not contain a valid pattern.
		/// </exception>
		/// <exception cref="ArgumentNullException">
		/// path is null.
		/// <para/>
		/// -or-
		/// <para/>
		/// searchPattern is null.
		/// </exception>
		/// <exception cref="ArgumentOutOfRangeException">
		/// searchOption is not a valid <see cref="SearchOption"/> value.
		/// </exception>
		/// <exception cref="DirectoryNotFoundException">
		/// path is invalid, such as referring to an unmapped drive.
		/// </exception>
		/// <exception cref="IOException">
		/// path is a file name.
		/// </exception>
		/// <exception cref="PathTooLongException">
		/// The specified path, file name, or combined exceed the system-defined maximum length. For
		/// example, on Windows-based platforms, paths must be less than 248 characters and file names
		/// must be less than 260 characters.
		/// </exception>
		/// <exception cref="SecurityException">
		/// The caller does not have the required permission.
		/// </exception>
		/// <exception cref="UnauthorizedAccessException">
		/// The caller does not have the required permission.
		/// </exception>
		IEnumerable<string> EnumerateFiles(
			string path,
			string searchPattern,
			SearchOption searchOption);
	}
}